<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>瑞州支付</title>
	<link rel="stylesheet"  href="../../../css/jquery.mobile-1.2.0.css" />
	<script src="../../../js/jquery.js"></script>
	<script src="../../../js/jquery.mobile-1.2.0.js"></script>
	<style type="text/css">
		.pay_content{
		        border: none;
		        border-radius: 10px;
		        -moz-border-radius:10px;
		        -o-border-radius:10px;
		        -webkit-border-radius: 10px;
		        background-color: #E7F7CE;
		        padding: 20px;
		}
		.result{
			display:none;
			margin-top:15px;
		}
	</style>

	<script type="text/javascript">
		//显示加载器
		function showLoader(str) {
			$.mobile.loading('show', {
				text: str, 			//加载器中显示的文字
				textVisible: true, //是否显示文字
				theme: 'a',         //加载器主题样式a-e
				textonly: false,   //是否只显示文字
				html: ""             //要显示的html内容，如图片等
			});
		}
	
		//隐藏加载器.
		function hideLoader(){
			$.mobile.loading('hide');
		}
	</script>

	<script type="text/javascript">
		$(document).ready(function(){
			check_result();
		});
		
		function check_result(){
			$.ajax({
				type: "post",
				url: "<?php echo base_url() ?>index.php/pay/get_telephone_card_pay_result",
				data:{encrypt_tran_id:"<?php echo $encrypt_tran_id?>"},
				dataType:"json",
				beforeSend: function(XMLHttpRequest){
					showLoader("正在支付,请稍后...");
				},
				success: function(data, textStatus){
			      	if (data.result==false) {
				      	hideLoader();
				      	$(".result").show();
				      	$(".load_text").html("<span style='color:red'>"+data.message+"</span>");
				      	
				      	//通知客户端
				      	window.JsGameCenter.notifyPayResult(data.orderId, data.productMoney,  data.payStatusCode);
				    	clearTimeout(t);
				    	return false;
					}
					if (data.url !="") {
						hideLoader();
						
						//通知客户端
				      	window.JsGameCenter.notifyPayResult(data.orderId, data.productMoney,  data.payStatusCode);
						
						showLoader("支付成功,正在转入成功页面...");
						setTimeout(hideLoader,1000);
						//跳转成功页面
						window.location.href=data.url;
					}
				},
				complete: function(XMLHttpRequest, textStatus){},
				error: function(){}
			});
			 t=setTimeout("check_result()",5000);
   		}
	</script>
	
</head>
<body>
<div data-role="page" data-theme="d">
	<div data-role="header" data-theme="b" data-position="fixed">
		<h1>电话卡支付</h1>
	</div>
	<div data-role="content" >
		<div class="pay_content result">
			<div class="ui-grid-a">
				<div class="ui-block-a">
					<img style="width:50px;height:50px;margin:20px 25px 0 0;float:right;" src="../../../static/imgs/notification_warning.png" />
				</div>
				<div class="ui-block-b">
					<p>订单未支付!</p>
				</div>
			</div>
		</div>
		<br />
		<div class="result">
			<p class="noticeText">您可以尝试重新充值或选择其他充值方式</p>
			<a href="javascript:history.go(-2);" data-role="button" data-theme="b">重新支付</a>
		</div>
	</div>
</div>
</body>
</html>